import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HealthClassificationVO, HealthClassificationForm, HealthClassificationQuery } from '@/api/system/healthClassification/types';

/**
 * 查询健康分类列表
 * @param query
 * @returns {*}
 */

export const listHealthClassification = (query?: HealthClassificationQuery): AxiosPromise<HealthClassificationVO[]> => {
  return request({
    url: '/system/healthClassification/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询健康分类详细
 * @param healthId
 */
export const getHealthClassification = (healthId: string | number): AxiosPromise<HealthClassificationVO> => {
  return request({
    url: '/system/healthClassification/' + healthId,
    method: 'get'
  });
};

/**
 * 新增健康分类
 * @param data
 */
export const addHealthClassification = (data: HealthClassificationForm) => {
  return request({
    url: '/system/healthClassification',
    method: 'post',
    data: data
  });
};

/**
 * 修改健康分类
 * @param data
 */
export const updateHealthClassification = (data: HealthClassificationForm) => {
  return request({
    url: '/system/healthClassification',
    method: 'put',
    data: data
  });
};

/**
 * 删除健康分类
 * @param healthId
 */
export const delHealthClassification = (healthId: string | number | Array<string | number>) => {
  return request({
    url: '/system/healthClassification/' + healthId,
    method: 'delete'
  });
};
